import { reqCategory } from '@/api'
import { reqBanner } from '@/api';
import { reqFloor } from '@/api';

const state = {
    category: [],
    bannerArr: [],
    floorArr: []
}

const mutations = {
    GETCATEGORY(state, category) {
        state.category = category;
    },
    GETBANNER(state, bannerArr) {
        state.bannerArr = bannerArr
    },
    GETFLOOR(state, floorArr) {
        state.floorArr = floorArr
    }
}


const actions = {
    async getcategory({ commit, state, dispath, getters }) {
        const result = await reqCategory();
        if (result.code == 200) {
            commit('GETCATEGORY', result.data)
        }
    },
    async getbanner({ commit, state, dispath, getters }) {
        const result = await reqBanner();
        if (result.code == 200) {
            commit('GETBANNER', result.data)
        }
    },
    async getfloor({ commit, state, dispath, getters }) {
        const result = await reqFloor();
        if (result.code == 200) {
            commit('GETFLOOR', result.data)
        }
    }
}


const getters = {

}

export default {
    state,
    mutations,
    actions,
    getters
}